<template>
	<view>
		<view class="slot-box">
			<view class="slot-yu">账户余额：<span style="font-weight: bold;margin-left:5rpx;">{{balance}}</span>
				<span style="margin-left:5rpx">元</span>
			</view>
			<button size="mini" class="green_btn" @click="recharge">余额充值</button>
		</view>
		<view class="slot-box">
			<view class="slot-yu">合同签署量：<span style="font-weight: bold;">{{companyInfo.remainingNum}}</span><span
					style="margin-left:5rpx">次</span></view>
			<button size="mini" class="green_btn" @click="product">立即购买</button>
		</view>
		<view class="menu-list" style="margin: 0;">
			<view class="list-cell list-cell-arrow">
				<view class="menu-item-box" @click="product">
					<view class="iconfont" style="color: skyblue;font-size: 26rpx;">&#xe640;</view>
					<view class="u_title">产品购买</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="recordList">
				<view class="menu-item-box">
					<view class="iconfont" style="color: blue;font-size: 26rpx;">&#xebd8;</view>
					<view class="u_title">签署套餐</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="companyOrder">
				<view class="menu-item-box">
					<view class="iconfont" style="color: #ff3474;font-size: 26rpx;">&#xe679;</view>
					<view class="u_title">企业订单</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="workBalance" v-if="$store.getters.staffInfo.companyId != 0 && companyInfo.loginType != 3">
				<view class="menu-item-box">
					<view class="iconfont" style="color: #00a660;font-size: 26rpx;">&#xe65c;</view>
					<view class="u_title">余额明细</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="signFlowFeeRecord">
				<view class="menu-item-box">
					<view class="iconfont" style="color:orange;font-size: 26rpx;">&#xe664;</view>
					<view class="u_title">签署明细</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="balanceRefund">
				<view class="menu-item-box">
					<view class="iconfont" style="color:lightskyblue;font-size: 26rpx;">&#xe621;</view>
					<view class="u_title">余额充值记录</view>
				</view>
			</view>
			<view class="list-cell list-cell-arrow" @click="invoice">
				<view class="menu-item-box">
					<view class="iconfont" style="color:#8ed369;font-size: 26rpx;">&#xea47;</view>
					<view class="u_title">已开具发票记录</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getCompanyInfo} from "@/api/ec/console/index";
	export default {
		data() {
			return {
				companyInfo: this.$store.getters.companyInfo,
				balance:'', //账户余额
			}
		},
		onLoad() {
			this.getCompanyInfo();
		},
		methods: {
			/** 已开具发票记录 */
			invoice(){
				this.$tab.navigateTo('./invoicesManage/index')
			},
			/** 余额退款记录 */
			balanceRefund(){
				this.$tab.navigateTo('/pages/mine/personal/product/balancePay/index')
			},
			/** 余额充值-企业-费用中心-余额充值 */
			recharge(){
        this.$goPay();
			},
			/** 企业订单 */
			companyOrder() {
				this.$tab.navigateTo('/pages/mine/work/product/order/order')
			},
			/** 签署套餐 */
			recordList() {
				this.$tab.navigateTo('/pages/mine/signFlowFeeOrder/companyIndex')
			},
			/** 余额明细 */
			workBalance() {
				this.$tab.navigateTo('/pages/mine/signFlowFeeOrder/balance/companyBalance')
			},
			/** 立即购买 */
			product() {
				this.$tab.navigateTo('/pages/mine/work/product/index')
			},
			/** 查询信息 */
			getCompanyInfo() {
        this.$modal.loading();
				getCompanyInfo().then(response => {
					uni.hideLoading()
					this.companyInfo = response.data;
					this.balance = this.companyInfo.company.balance
				});
			},
			/** 签署明细 */
			signFlowFeeRecord(){
				this.$tab.navigateTo('/pages/mine/signFlowFeeOrder/signFlowFeeRecord/comapnySignFlowFeeRecord')
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		background: $uni-bg-color;
	}

	.u_title {
		margin-left: 10rpx;
	}
</style>
